<?php
class Conexion{

private $Servidor = 'localhost';
private $Usuario ='root';
private $Clave='letty';
private $Basedato='magsi_db';



private function Conectar(){
$con = mysqli_connect($this->Servidor,$this->Usuario,$this->Clave,$this->Basedato) or die('error');
return $con;
}

public function insertarUso($IDFI,$US,$CAHE){

	$US = implode("|",$_POST["us"]);

 $sql = "INSERT INTO ma_af_usotierra ( MA_InFinca,MA_V_TipoUsos,MA_Dc_CantHec)
 	 VALUES ('$IDFI,$US,$CAHE')";

     $con =$this->Conectar();
      mysqli_query($con,$sql) or die('no insertado'.mysqli_error($con));

      if($con){

header('location:index.php');


      }
}

public function insertarExplota($EX,$IDFI){

$EX = implode("|",$_POST["ex"]);
 $sql = "INSERT INTO ma_af_explotierra (MA_In_IdFinca,MA_V_TipoExplot)
 	 VALUES (' $EX,$IDFI')";
     $con =$this->Conectar();
      mysqli_query($con,$sql) or die('no insertado'.mysqli_error($con));

      if($con){

header('location:index.php');


}

      }


public function insertarApar($CAAP,$AP,$IDFI){

$AP = implode("|",$_POST["ap"]);
 $sql = "INSERT INTO ma_af_apartos (MA_In_CantApartos,MA_V_TipoPoste,MA_In_IdFinca)
 	 VALUES (' $CAAP,$AP,$IDFI')";
     $con =$this->Conectar();
      mysqli_query($con,$sql) or die('no insertado'.mysqli_error($con));

      if($con){

header('location:index.php');


}

      }


public function insertarFerti($DES,$FERTI,$IDFI){


 $FERTI = $_POST['ferti'];
$ssc= $_POST['ssc'];
$sql = "INSERT INTO ma_af_fertiliz(MA_V_DescFertiliz,MA_TI_OpcContiene, MA_In_IdFinca)
 	 VALUES (' $DES,$FERTI,$IDFI')";
     $con =$this->Conectar();
      mysqli_query($con,$sql) or die('no insertado'.mysqli_error($con));

      if($con){

header('location:index.php');


}

      }




 
	}





?>